package com.kaisu.blog.infrastructure.blog;

import com.kaisu.blog.infrastructure.user.UserPO;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.UpdateTimestamp;

import java.time.LocalDateTime;

/**
 * @author kaisu
 */
@Getter
@Setter
@Entity
@ToString
@DynamicInsert
@DynamicUpdate
@Table(name = "`comment`")
public class CommentPO {
    /**
     * 主键
     */
    @Id
    private String id;
    /**
     * 内容
     */
    private String content;
    /**
     * 创建用户
     */
    @ManyToOne
    @JoinColumn(name = "send_user_id")
    private UserPO sendUser;
    /**
     * 发送时间
     */
    private LocalDateTime sendTime;
    /**
     * 创建时间
     */
    @CreationTimestamp
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @UpdateTimestamp
    private LocalDateTime updateTime;
}
